﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ADL;
using CDIO.Models;

namespace CDIO.Controllers
{
    public class DataRecordController : Controller
    {
        //
        // GET: /DataRecord/
        public RecordModel recordModel = null;

        public ActionResult GiftRecord(string username)
        {
            ViewBag.Message = username;

            ADL_record ad_us = new ADL_record();
            _record us = new _record();
            List<_record> listuse = ad_us.search(null, "*");
            if (listuse != null)
            {
                recordModel = new RecordModel
                {
                    UserModel_record = listuse
                };
                return View(recordModel);
            }

            return View();
        }

        public ActionResult Gift_Delete(string _user_id)
        {
            ADL_record ad_us = new ADL_record();
            _record us = new _record();
            us._record_id = _user_id;
            if (ad_us.delete(us))
            {
                return Json(new { Result = true, Message = "删除成功" });
            }

            return Json(new { Result = true, Message = "删除失败" });
        }
    }
}
